﻿using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using HandRise.MBHOP.Controls;
using Handrise.CDCable.Mobile.Business;


namespace Handrise.CDCable.Mobile.UI
{
    public partial class FrmMain : FrmBase
    {
        public FrmMain()
        {
            InitializeComponent();

            pictureBox1.Image = ResourceImage.导航背景;
            btnPatrolManage.UpImage = ResourceImage._01界面修改3_02;
            btnDeviceManage.UpImage = ResourceImage._01界面修改3_03;
            btnGIS.UpImage = ResourceImage._01界面修改3_05;
            btnFlawManage.UpImage = ResourceImage._01界面修改3_06;
            btnTemperature.UpImage = ResourceImage._01界面修改3_07;
            btnSynchronize.UpImage = ResourceImage._01界面修改3_08;
            btnCommunication.UpImage = ResourceImage._01界面修改3_09;
            ibtnlink.UpImage = ResourceImage._01界面修改3_10;
            ibtnclose.UpImage = ResourceImage._01界面修改3_12;
       
            btnPatrolManage.DownImage = ResourceImage._01界面修改_02;
            btnDeviceManage.DownImage = ResourceImage._01界面修改_03;
            btnGIS.DownImage = ResourceImage._01界面修改_05;
            btnFlawManage.DownImage = ResourceImage._01界面修改_06;
            btnTemperature.DownImage = ResourceImage._01界面修改_07;
            btnSynchronize.DownImage = ResourceImage._01界面修改_08;
            btnCommunication.DownImage = ResourceImage._01界面修改_09;
            ibtnlink.DownImage = ResourceImage._01界面修改_10;
            ibtnclose.DownImage = ResourceImage._01界面修改_12;
        }

        private void FrmMain_Load(object sender, EventArgs e)
        {
            this.ttlbrhead.Visible = false;
            ibtnstar.Visible = false;
            ibtntime.Visible = false;
            pbBattery.Visible = false;
            pbGPS.Visible = false;
            pbSignal.Visible = false;
        }

        private void imageButton1_Click_1(object sender, EventArgs e)
        {
            FormManage.GotoNext("FrmTask", null,null, false);
   
        }

        private void imageButton7_Click(object sender, EventArgs e)
        {
            if (mssdlgexec.ShowDialog(this, "确认退出系统？", DialogType.Select, FormManage.form_Deactivate) == MessageDialogResult.Button1)
            {

                MakeFullScreen.toRegularScr(this);
                Application.Exit();
            }
        }

        private void imageButton6_Click(object sender, EventArgs e)
        {

            FormManage.GotoNext("FrmDataDown", null,null , false);
 
        }

        private void imageButton8_Click(object sender, EventArgs e)
        {
            APNService apnService = new APNService();
            int re = apnService.ConnectAPN();
            switch (re)
            {
                case 0:
                    mssdlgexec.ShowDialog(this, "网络连接成功", DialogType.Confirm, FormManage.form_Deactivate);
                    break;
                case 1:
                    mssdlgexec.ShowDialog(this, "USB连接状态下不能进行APN连接", DialogType.Confirm, FormManage.form_Deactivate);
                    break;
                case -1:
                    mssdlgexec.ShowDialog(this, "网络连接失败", DialogType.Confirm, FormManage.form_Deactivate);
                    break;

            }
 
        }

        private void imageButton3_Click(object sender, EventArgs e)
        {
        
             FormManage.GotoNext("FrmGIS", new object[] { "FrmMain", null },null, false);
            
 
        }

        private void imageButton9_Click(object sender, EventArgs e)
        {
             //FormManage.GotoNext("FrmCommand", null,null, false);
 
        }

        private void btnDeviceManage_Click(object sender, EventArgs e)
        {
            FormManage.GotoNext("FrmDeviceSelect", null, null, false);
        }

        private void btnFlawManage_Click(object sender, EventArgs e)
        {
            FormManage.GotoNext("FrmFlawList", new object[] { "FrmMain", null }, null, false);
        }

        private void btnCommunication_Click(object sender, EventArgs e)
        {
            FormManage.GotoNext("FrmCommunication", null, null, false);
        }

        private void btnTemperature_Click(object sender, EventArgs e)
        {
            FormManage.GotoNext("FrmTemperatureList", null, null, false);
        }


    }
}